﻿
--岗位异动审批
CREATE proc [dbo].[proc_Employee_PostMove_Audit]
(
	@Id int,
	@Audit bit,
	@Memo text,
	@UserName nvarchar (50),
	@AuditClass varchar(10)
--	@AuditTime nvarchar(50)
)
As
Begin
	If @AuditClass='2' --二级审批
		Update Employee_PostMove Set SecondAudit=@Audit,SecondMemo=@Memo,SecondAuditPerson=@UserName,SecondAuditTime=GetDate() Where id=@id
	Else	--一级审批
		Update Employee_PostMove Set FirstAudit=@Audit,FirstMemo=@Memo,FirstAuditPerson=@UserName,FirstAuditTime=GetDate() Where id=@id
End
--	begin
--	
--	declare @FirstAuditPerson nvarchar(50)
--	set @FirstAuditPerson = (select FirstAuditPerson from employee_PostMove where id=@id)
--	declare @eid int
--	set @eid = (select eid from employee_PostMove where id=@id)
--
--		--一级审批
--		if(@FirstAuditPerson is null)
--			begin
--				update employee_PostMove set FirstAudit=@Audit,FirstMemo=@Memo,FirstAuditPerson=@UserName,FirstAuditTime=@AuditTime where id=@id
--			end
--		--二级审批
--		else
--			begin
--				update employee_PostMove set SecondAudit=@Audit,SecondMemo=@Memo,SecondAuditPerson=@UserName,SecondAuditTime=@AuditTime where id=@id
--
--			end
--	end
